package com.gdit.revenue.dao;
import com.gdit.revenue.model.Income;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface IncomeDao {

    //分页查询user表数据
    @Select("select * from income limit #{offset},#{limit}")  // 检索记录行 offset-limit   如：0-4 5-9
    List<Income> getAllIncome(int offset, int limit);


    //统计user表总条数
    @Select("select count(*) from income")
    int count();


    //删除user表单单条数据
    @Delete("delete from income where in_id=#{in_id}")
    int delete(int inId);

    //向user表新增数据
    @Insert("insert into income (in_id,in_title,in_name,in_money,in_way,in_remarks,in_time) values(#{inId},#{inTitle}," +
            "#{inName},#{inMoney},#{inWay},#{inRemarks},#{inTime})")
    int insert(Income income);

    //修改user表数据
    @Update("update income set in_title=#{inTitle},in_name=#{inName},in_money=#{inMoney},in_way=#{inWay}," +
            "in_remarks=#{inRemarks},in_time=#{inTime} where in_id=#{inId}")
   int update(Income income);
}